package org.seckill.dao;

import org.apache.ibatis.annotations.Param;
import org.seckill.entity.SuccessKilled;
import org.seckill.entity.SuccessKilledKey;

import java.util.Map;

public interface SuccessKilledMapper {
    int deleteByPrimaryKey(SuccessKilledKey key);

    int insert(SuccessKilled record);

    int insertSelective(SuccessKilled record);

    SuccessKilled selectByPrimaryKey(SuccessKilledKey key);

    int updateByPrimaryKeySelective(SuccessKilled record);

    int updateByPrimaryKey(SuccessKilled record);

    /**
     * 插入购买明细,可过滤重复秒杀
     * @param seckillId
     * @param userPhone
     * @return
     */
    int insetSuccessKilled(@Param(value = "seckillId") Long seckillId,@Param(value = "userPhone") Long userPhone);

    /**
     * 根据ID,USERPHONE查询SuccessKilled对象，携带秒杀产品对象
     * @param seckillId
     * @return
     */
    SuccessKilled queryByIdWithSeckill(@Param("seckillId") Long seckillId,@Param("userPhone") Long userPhone);

    /**
     * 使用存储过程执行秒杀
     * @param paramMap
     */
    void killByProcedure(Map<String,Object> paramMap);

}